﻿using Compass.Wasm.Shared.Wms;
using Zack.DomainCommons.Models;

namespace Compass.WmsService.Domain.Entities;

public record Vendor : AggregateRootEntity
{
    public string Number { get; private set; }
    public string Name { get; private set; }
    public string? Contact { get; private set; }//联系人
    public string? Address { get; private set; }//地址
    public string? Telephone { get; private set; }
    public string? Remarks { get; private set; }

    private Vendor() { }
    public Vendor(Guid id,string number,string name,string? contact,string? address,string? telephone,string? remarks)
    {
        Id=id;
        Number=number;
        Name=name;
        Contact=contact;
        Address=address;
        Telephone=telephone;
        Remarks=remarks;
    }

    public void Update(VendorDto dto)
    {
        ChangeNumber(dto.Number)
            .ChangeName(dto.Name)
            .ChangeContact(dto.Contact)
            .ChangeAddress(dto.Address)
            .ChangeTelephone(dto.Telephone)
            .ChangeRemarks(dto.Remarks);
        NotifyModified();
    }

    public Vendor ChangeNumber(string number)
    {
        Number=number;
        return this;
    }
    public Vendor ChangeName(string name)
    {
        Name=name;
        return this;
    }

    public Vendor ChangeContact(string? contact)
    {
        Contact=contact;
        return this;
    }
    public Vendor ChangeAddress(string? address)
    {
        Address=address;
        return this;
    }
    public Vendor ChangeTelephone(string? telephone)
    {
        Telephone=telephone;
        return this;
    }
    public Vendor ChangeRemarks(string? remarks)
    {
        Remarks=remarks;
        return this;
    }
}